﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerBodyPart : MonoBehaviour
{
    public BodyPart upperBodyPart;
    [SerializeField]
    BodyPart lowerBodyPart;

    private void OnValidate()
    {
        {
            if (upperBodyPart != null && transform.Find("上半身").TryGetComponent(out SpriteRenderer sr))
            {
                sr.sprite = upperBodyPart.sprite;
            }
        }
        {
            if (lowerBodyPart != null && transform.Find("下半身").TryGetComponent(out SpriteRenderer sr))
            {
                sr.sprite = lowerBodyPart.sprite;
            }
        }
    }
}
